package xdpm.nhom16.DAO;

import xdpm.nhom16.DTO.TuKhoaQuanHuyenDTO;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

public class TuKhoaQuanHuyenDAO extends AbstractTuKhoaDAO<TuKhoaQuanHuyenDTO> {

	private static final String COLUMN_PARENT = "MaQuanHuyen";
	protected static final String COLUMN_TUKHOA = "TuKhoaQuanHuyen";
	protected static final String COLUMN_ID = "MaTuKhoaQuanHuyen";
	protected static final String[] NAME_COLUMNS = new String[] { COLUMN_ID, COLUMN_TUKHOA,
			COLUMN_PARENT };
	protected static final String TABLE_NAME = "TUKHOAQUANHUYEN";

	public TuKhoaQuanHuyenDAO(SQLiteDatabase db) {
		// TODO Auto-generated constructor stub
		super(db);
	}

	@Override
	protected String getTableName() {
		return TABLE_NAME;
	}

	@Override
	protected String getNameColumnId() {

		return COLUMN_ID;
	}

	@Override
	protected String[] getNameColumns() {

		return NAME_COLUMNS;
	}

	@Override
	protected TuKhoaQuanHuyenDTO cusorToDTO(Cursor cursor) {
		TuKhoaQuanHuyenDTO dto = new TuKhoaQuanHuyenDTO();
		dto.setMaTuKhoaQuanHuyen(cursor.getInt(0));
		if (!cursor.isNull(1))
			dto.setTuKhoaQuanHuyen(cursor.getString(1));
		if (!cursor.isNull(2))
			dto.setMaQuanHuyen(cursor.getInt(2));
		return dto;
	}

	@Override
	protected String getNameColumnTuKhoa() {
		return COLUMN_TUKHOA;
	}

	@Override
	protected String getNameColumnRefIdParent() {
		// TODO Auto-generated method stub
		return COLUMN_PARENT;
	}

}
